<?xml version="1.0" encoding="UTF-8" ?>
<!-- jsf:pagecode language="java" location="/src/pagecode/Tecajnicepreracun.java" --><!-- /jsf:pagecode -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:c="http://java.sun.com/jsp/jstl/core">
<ui:composition template="layout/pageLayout.xhtml">

	<ui:define name="content">

	<p:growl id="growl" showDetail="true" life="5000" />
	<p:fieldset legend="Parametri preracuna" toggleable="true"
		toggleSpeed="500">
		<h:form id="VnosParamtrov">
			<p:panelGrid>
				<p:row>
					<p:column>
						<h:outputLabel value="Izberi vrsto tečajnice za preracun: "
							for="izbiraVrsteTecajnice" />
					</p:column>
					<p:column>
						<p:selectOneMenu id="izbiraVrsteTecajnice"
							value="#{preracunTecajnic.sifraIzbraneVrstaTecajnice}" effect="fade"
							required="true">
							<f:selectItems value="#{preracunTecajnic.seznamVrstTecajnic}"
								var="vrstaTecajnice"
								itemValue="#{vrstaTecajnice.sifraVrsteTecajnice}"
								itemLabel="#{vrstaTecajnice.nazivVrsteTecajnice}" />
						</p:selectOneMenu>
					</p:column>
				</p:row>
				<p:row>
					<p:column>
						<h:outputLabel value="Izberi datum za preracun: " for="izbiraDatuma" />
					</p:column>
					<p:column>
						<p:calendar id="izbiraDatuma" value="#{preracunTecajnic.izbranDatum}"
							navigator="true" display="inline" required="true">
						</p:calendar>
					</p:column>
				</p:row>
				<p:row>
					<p:column colspan="2">
						<h:commandButton value="Preracunaj tecajnico"
							action="#{preracunTecajnic.preracunajTecajnico}"
							update="testPrikazTecajnice" />
					</p:column>
				</p:row>
			</p:panelGrid>
		</h:form>
	</p:fieldset>

	<c:if id="testPrikazTecajnice" test="#{preracunTecajnic.tecajnicaPreracunana}">
		<p:fieldset legend="Rezultati preracuna">
			<p:dataTable var="tecaj" value="#{preracunTecajnic.izbranaTecajnica.tecaji}"
				emptyMessage="Tečajnic s temi kriteriji ni bilo mogoče najti.">
				<p:column id="Valuta" headerText="Valuta">
					<h:outputText value="#{tecaj.valuta.oznakaValute}" />
				</p:column>

				<c:if test="#{preracunTecajnic.srednjiTecajiNapolnjeni}">
					<p:column>
						<f:facet name="header">
							<h:outputText value="Srednji tecaj" />
						</f:facet>
						<h:outputText value="#{tecaj.srednjiTecaj}" />
					</p:column>
				</c:if>
				<c:if test="#{preracunTecajnic.nakupniTecajiNapolnjeni}">
					<p:column>
						<f:facet name="header">
							<h:outputText value="Nakupni tecaj" />
						</f:facet>
						<h:outputText value="#{tecaj.nakupniTecaj}" />
					</p:column>
				</c:if>
				<c:if test="#{preracunTecajnic.prodajniTecajiNapolnjeni}">
					<p:column>
						<f:facet name="header">
							<h:outputText value="Prodajni tecaj" />
						</f:facet>
						<h:outputText value="#{tecaj.prodajniTecaj}" />
					</p:column>
				</c:if>
			</p:dataTable>
		</p:fieldset>
	</c:if>

</ui:define>
</ui:composition>
</html>